package com.yuda.system.fegin;

import com.yuda.common.core.domain.R;
import com.yuda.common.core.web.domain.AjaxResult;
import com.yuda.system.api.domain.SysDept;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteCampDeptFeginFallbackFactory  implements FallbackFactory<RemoteCampDeptFegin> {

    private static final Logger log = LoggerFactory.getLogger(RemoteCampDeptFeginFallbackFactory.class);

    @Override
    public RemoteCampDeptFegin create(Throwable throwable) {
        log.error("camp服务调用失败:{}", throwable.getMessage());

        return new RemoteCampDeptFegin() {
            @Override
            public R<AjaxResult> add(SysDept dept) {
                log.error("add 服务调用失败:{}", throwable.getMessage());
                return null;
            }

            @Override
            public R<AjaxResult> edit(SysDept dept) {
                log.error("edit 服务调用失败:{}", throwable.getMessage());
                return null;
            }

            @Override
            public R<AjaxResult> remove(Long deptId) {
                log.error("remove 服务调用失败:{}", throwable.getMessage());
                return null;
            }
        };
    }
}
